
export default function request(url, method, token, data, callback) {
  wx.request({
    url: url,
    method: method,
    header: {
      'token': token,
      'content-type': 'application/x-www-form-urlencoded'
    },
    data: data,
    success: function (res) {
      if (res.statusCode >= 200 && res.statusCode < 300) {
        return callback(null, res.data)
      } else {
        return callback(res)
      }
    },
    fail: function (res) {
      console.log(res)
      return callback(res)
    }
  })
} 